package org.papervision3d.objects
{
	import org.papervision3d.core.proto.MaterialObject3D;
	import org.papervision3d.core.geom.Mesh3D;
	import org.papervision3d.core.proto.CameraObject3D;
	import org.papervision3d.core.proto.TraverseCallback;
	import org.papervision3d.core.geom.Face3D;
	import org.papervision3d.core.proto.PathfinderCallback;

	public class WallMesh extends Mesh3D
	{
		
		
		public function WallMesh(mesh : Mesh3D )
		{
			super(mesh.material, mesh.name);
			
			visible = false;
			
			this.mesh = mesh;
		}
		
		
		public override function project(parent:DisplayObject3D, camera:CameraObject3D, callback:TraverseCallback):void
        {
            super.project(parent, camera, callback);

            var faces:Array = this.faces;
            var face:Face3D;
    
            for (var i:int = 0; face = faces[i]; i++)
            {
                callback.face(face, this);
            }
            
            if( callback is PathfinderCallback ) parent.removeChild( this );
        }
        
		private var mesh : Mesh3D;
	}
}

